package com.fpt.group3.service.exception;

import com.fpt.group3.service.exception.LoggerClass;

/**
 * 
 * @author John Tran
 *
 */
public class SystemException extends Exception {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String className;
	private String packageName;
	private String methodName;

	public SystemException(Class<?> classObj, String className, String message) {
		super(message);
		this.packageName = (classObj.getPackage().getName()) != null ? (classObj
				.getPackage().getName()) : "";
		this.methodName = (classObj.getEnclosingMethod().getName()) != null ? (classObj
				.getEnclosingMethod().getName()) : "";
		this.className = className != null ? className : "";
	}

	public SystemException(String message) {
		super(message);
		LoggerClass.error(SystemException.class.getName(), message);
	}

	public SystemException() {
	}

	public String getType() {
		return "SystemException";
	}

	public String getClassName() {
		return className;
	}

	public String getPackageName() {
		return packageName;
	}

	public String getMethodName() {
		return methodName;
	}

	@Override
	public String getMessage() {
		return super.getMessage();
	}
}
